<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>骨医快线</title>
    <link href="../../css/mui.plus.css" rel="stylesheet"/>
    <style>
		.oe-login input {
			border-bottom: 1px solid #ccc;
			background-color: #fff;
		}
		button.disabled {
		    border: 1px solid #ccc!important;
		    color: #999!important;
		    background: #fff!important;
		}
	</style>
</head>
<body>
	<span class="mui-action-back" style="position: absolute;right: 20px;top: 20px;color: #999;">关闭</span>
	<div class="mui-content oe-login">
		<form class="mui-input-group">
			<div class="mui-input-row"  style="margin-bottom: 15px;">
				<input id="pwdInp" type="password" class="mui-input-clear" placeholder="设置密码">
			</div>
			<div class="mui-input-row"  style="margin-bottom: 15px;">
				<input id="pwdConInp" type="password" class="mui-input-clear" placeholder="确认密码">
			</div>
				
			<button id="regBtn" type="button" class="mui-btn mui-btn-primary oe-btn-block" onclick="return false;">登&nbsp;&nbsp;&nbsp;陆</button>&nbsp;&nbsp;
		</form>
	</div>
		
    <script src="../../js/mui.min.js"></script>
    <script src="../../js/app.js"></script>
    <script src="../../js/lib/md5.js"></script>
    <script type="text/javascript" charset="UTF-8">
    (function($,doc){
    	var login = app.login;
    	var regInfo = {};//注册信息
		
		$.plusReady(function(){
  			plus.screen.lockOrientation('portrait-primary');
  			
  			var self = plus.webview.currentWebview();
			regInfo.account = self.account;
			
			var pwdInp = doc.getElementById('pwdInp');
			var pwdConInp = doc.getElementById('pwdConInp');
			var regBtn = doc.getElementById('regBtn');
			
			$.preload({
				id: 'user-info',
  				url:'user-info.html'
			});
			
			regBtn.addEventListener('tap',function(event){
				regInfo.password = hex_md5(pwdInp.value);
				var pwdConfirm = hex_md5(pwdInp.value);
				if (pwdConfirm != regInfo.password) {
					plus.nativeUI.toast('两次输入的密码不一致');
					return;
				}
				login.reg(regInfo,function(err){
					if(err){
						plus.nativeUI.toast(err);
						return;
					}
					plus.nativeUI.toast('注册成功');
					$.openWindow({
						id: 'user-info',
						show: { 
							aniShow: 'slide-in-bottom'
						}
					});
				});
			})
		});
    }(mui,document));
    </script>
</body>
</html>